package com.fdb.efp.nls.service.impl;

import com.alibaba.dubbo.rpc.service.GenericException;
import com.alibaba.dubbo.rpc.service.GenericService;
import com.fdb.basic.framework.core.vo.OrgInfoCacheVO;
import com.fdb.efp.nls.service.dao.OrgInfoCacheDao;
import com.fdb.efp.nls.service.facade.AccountOrgCacheService;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("accountOrgCacheService")
public class AccountOrgCacheServiceImpl implements AccountOrgCacheService, GenericService {

private static Logger logger = LoggerFactory.getLogger(OrgInfoCacheServiceImpl.class);
    
    @Autowired
    private OrgInfoCacheDao orgInfoCacheDao;
    
    @Override
	public List<OrgInfoCacheVO> queryAll() {
        List<OrgInfoCacheVO> vos = null;
        try {
            logger.info("查询缓存账务机构信息开始......");
            vos = orgInfoCacheDao.queryAccountAll();
            logger.info("查询缓存账务机构信息结束, 查询数据条数:"+ vos.size());
        } catch (Exception e) {
            logger.error("查询缓存账务机构信息出现异常!", e);
        }
        return vos;
    }

	/**
	 * 实现 GenericService 重写invok方法
	 * 
	 * @param method
	 * @param parameterTypes
	 * @param args
	 * @return
	 * @throws GenericException
	 * @author zhangze
	 * @since 2019年3月30日 下午4:23:39
	 * @version 1.0
	 */
	@Override
	public Object $invoke(String method, String[] parameterTypes, Object[] args) throws GenericException {
		List<OrgInfoCacheVO> resuList = null;
		if (StringUtils.isNotBlank(method) && method.equals("queryAll")) {
			resuList = queryAll();
		}
		return resuList;
	}

}
